package tk.mystudio.web.action;

import tk.mystudio.util.Order;
import tk.mystudio.util.Page;

import com.opensymphony.xwork2.ActionSupport;

public abstract class CommonAction<T> extends ActionSupport {

	protected final String INDEX = "index"; // 主页面(查询页面)
	protected final String EDIT = "edit"; // 编辑页面
	protected final String VIEW = "view"; // 查看页面
	protected final String CREATE = "create"; // 新建页面

	protected final String LIST = "json"; // JSON结果

	// 前台分页参数
	protected Integer pageSize;
	protected Integer currentPage;
	protected String sortField;
	protected String order;

	protected Page<T> page;
	protected Order[] orders;

	public String index() {
		return INDEX;
	}

	public String create() {
		return CREATE;
	}

	public String edit() {
		return EDIT;
	}

	public String view() {
		return VIEW;
	}

	public Integer getPageSize() {
		return pageSize;
	}

	public void setPageSize(Integer pageSize) {
		this.pageSize = pageSize;
	}

	public Integer getCurrentPage() {
		return currentPage;
	}

	public void setCurrentPage(Integer currentPage) {
		this.currentPage = currentPage;
	}

	public String getSortField() {
		return sortField;
	}

	public void setSortField(String sortField) {
		this.sortField = sortField;
	}

	public String getOrder() {
		return order;
	}

	public void setOrder(String order) {
		this.order = order;
	}

	public Order[] getOrders() {
		return orders;
	}

	public void setOrders(Order[] orders) {
		this.orders = orders;
	}

	public abstract Page<T> getPage();

}
